package com.example.demo.mapper;

import com.example.demo.entity.Artical;
import com.example.demo.entity.ArticleVO;
import com.example.demo.entity.Book;
import com.example.demo.entity.BookVO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BookMapper {
    //查询分页
    List<Book> getpage3(BookVO bookVO);
    //查询总条数
    Integer getcount3(BookVO bookVO);
    //删除数据
    @Delete("delete from b_bookguanli where id=#{id}")
    public Integer delete3(Integer id);
    //id查询
    @Select("select * from b_bookguanli where id=#{id}")
    public Book tanchu3(Integer id);
    //更新
    @Update("update b_bookguanli SET bookname=#{bookname},isbn=#{isbn},publish=#{publish},wirter=#{wirter},number=#{number},categary=#{categary},position=#{position} where id=#{id}")
    public int update3(Book book);
    //新建
    @Insert("INSERT INTO b_bookguanli (id, bookname, isbn, publish, categary, wirter, number, position) " +
            "VALUES (#{id},  #{bookname}, #{isbn}, #{publish}, #{categary}, #{wirter}, #{number}, #{position})")
    @Options(useGeneratedKeys = true, keyProperty = "id" , keyColumn = "id")
    public Integer insert3(Book book);
    //批量删除
    Integer Bydelete3(Integer[] id);
    //查询分页
    List<Book> getpage9(BookVO bookVO);
    //查询总条数
    Integer getcount9(BookVO bookVO);

}
